<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha256-CTSx/A06dm1B063156EVh15m6Y67pAjZZaQc89LLSrU=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.24/fancybox/fancybox.css" integrity="sha256-vQkngPS8jiHHH0I6ABTZroZk8NPZ7b+MUReOFE9UsXQ=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"rjyblog.gitee.io","root":"/","images":"/images","scheme":"Pisces","darkmode":false,"version":"8.18.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":null},"fold":{"enable":false,"height":500},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="桥拦截器主要用于用户和网络数据之间的转换">
<meta property="og:type" content="article">
<meta property="og:title" content="okhttp详解系列三：桥拦截器 BridgeInterceptor">
<meta property="og:url" content="https://rjyblog.gitee.io/posts/6e2b1d41.html">
<meta property="og:site_name" content="任建勇的博客">
<meta property="og:description" content="桥拦截器主要用于用户和网络数据之间的转换">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2023-08-19T07:08:00.000Z">
<meta property="article:modified_time" content="2023-09-21T02:47:28.520Z">
<meta property="article:author" content="Jason">
<meta property="article:tag" content="okhttp">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://rjyblog.gitee.io/posts/6e2b1d41.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://rjyblog.gitee.io/posts/6e2b1d41.html","path":"posts/6e2b1d41.html","title":"okhttp详解系列三：桥拦截器 BridgeInterceptor"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>okhttp详解系列三：桥拦截器 BridgeInterceptor | 任建勇的博客</title>
  








  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">任建勇的博客</p>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#BridgeInterceptor%E5%A4%84%E7%90%86%E6%97%B6%E5%BA%8F"><span class="nav-text">BridgeInterceptor处理时序</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Jason"
      src="/images/avatar.png">
  <p class="site-author-name" itemprop="name">Jason</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">66</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">13</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://rjyblog.gitee.io/posts/6e2b1d41.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.png">
      <meta itemprop="name" content="Jason">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="任建勇的博客">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="okhttp详解系列三：桥拦截器 BridgeInterceptor | 任建勇的博客">
      <meta itemprop="description" content="桥拦截器主要用于用户和网络数据之间的转换">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          okhttp详解系列三：桥拦截器 BridgeInterceptor
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-08-19 15:08:00" itemprop="dateCreated datePublished" datetime="2023-08-19T15:08:00+08:00">2023-08-19</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2023-09-21 10:47:28" itemprop="dateModified" datetime="2023-09-21T10:47:28+08:00">2023-09-21</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/okhttp/" itemprop="url" rel="index"><span itemprop="name">okhttp</span></a>
        </span>
    </span>

  
</div>

            <div class="post-description">桥拦截器主要用于用户和网络数据之间的转换</div>
        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><ul>
<li><a href="/posts/78efaca4.html" title="okhttp详解系列一：开篇">okhttp详解系列一：开篇</a></li>
<li><a href="/posts/8e83ed63.html" title="okhttp详解系列二：重试重定向拦截器">okhttp详解系列二：重试重定向拦截器</a></li>
<li><a href="/posts/6e2b1d41.html" title="okhttp详解系列三：桥拦截器 BridgeInterceptor">okhttp详解系列三：桥拦截器 BridgeInterceptor</a></li>
<li><a href="/posts/37107c2e.html" title="okhttp详解系列四：缓存拦截器">okhttp详解系列四：缓存拦截器</a></li>
<li><a href="/posts/ee27d764.html" title="okhttp详解系列五：连接拦截器 ConnectInterceptor">okhttp详解系列五：连接拦截器 ConnectInterceptor</a></li>
<li><a href="/posts/73cf04e1.html" title="okhttp详解系列六：服务请求拦截器 CallServerInterceptor">okhttp详解系列六：服务请求拦截器 CallServerInterceptor</a>

</li>
</ul>
<p>BridgeInterceptor拦截器简要描述一下就是做了如下三件事：</p>
<ol>
<li>首先会把用户的Request进行进一步的处理（处理request header），转换成真正请求网络的Request；</li>
<li>然后继续调用其他拦截器进行网络请求；</li>
<li>最后收到响应结果后保存cookie，并解压缩gzip，最终转换为用户的Response。</li>
</ol>
<h2 id="BridgeInterceptor处理时序"><a href="#BridgeInterceptor处理时序" class="headerlink" title="BridgeInterceptor处理时序"></a>BridgeInterceptor处理时序</h2><?xml version="1.0" encoding="us-ascii" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="642px" preserveAspectRatio="none" style="width:948px;height:642px;background:#FFFFFF;" version="1.1" viewBox="0 0 948 642" width="948px" zoomAndPan="magnify"><defs/><g><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="116.5" x2="116.5" y1="36.2969" y2="606.9844"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="436.5" x2="436.5" y1="36.2969" y2="606.9844"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="607" x2="607" y1="150.3438" y2="606.9844"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="722" x2="722" y1="36.2969" y2="606.9844"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="857" x2="857" y1="36.2969" y2="606.9844"/><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="145" x="44.5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="131" x="51.5" y="24.9951">BridgeInterceptor</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="145" x="44.5" y="605.9844"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="131" x="51.5" y="625.9795">BridgeInterceptor</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="73" x="400.5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="59" x="407.5" y="24.9951">Request</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="73" x="400.5" y="605.9844"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="59" x="407.5" y="625.9795">Request</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="128" x="543" y="605.9844"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="114" x="550" y="625.9795">Request.Builder</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="82" x="681" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="68" x="688" y="24.9951">CookieJar</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="82" x="681" y="605.9844"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="68" x="688" y="625.9795">CookieJar</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="169" x="773" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="155" x="780" y="24.9951">RealInterceptorChain</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="169" x="773" y="605.9844"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="155" x="780" y="625.9795">RealInterceptorChain</text><ellipse cx="7.5" cy="66.6797" fill="none" rx="4" ry="4" style="stroke:#181818;stroke-width:1.5;"/><polygon fill="#181818" points="105,63.4297,115,67.4297,105,71.4297,109,67.4297" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="12" x2="111" y1="67.4297" y2="67.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="57" x="15" y="62.3638">intercept</text><polygon fill="#181818" points="425,107.6953,435,111.6953,425,115.6953,429,111.6953" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="431" y1="111.6953" y2="111.6953"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="80" x="124" y="91.4966">newBuilder()</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="296" x="124" y="106.6294">&#22522;&#20110;&#29992;&#25143;&#20256;&#20837;&#30340;Request&#29983;&#25104;&#26032;&#30340;Request.Builder</text><polygon fill="#181818" points="531,121.6953,541,125.6953,531,129.6953,535,125.6953" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="437" x2="537" y1="125.6953" y2="125.6953"/><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="128" x="543" y="119.6953"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="114" x="550" y="139.6904">Request.Builder</text><polygon fill="#181818" points="595,193.2578,605,197.2578,595,201.2578,599,197.2578" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="197.2578" y2="197.2578"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="262" x="124" y="177.0591">&#22914;&#26524;body&#19981;&#20026;null&#65292;&#21017;&#26681;&#25454;&#38656;&#35201;&#28155;&#21152;&#35831;&#27714;&#22836;&#65306;</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="331" x="124" y="192.1919">Content-Type&#12289;Content-Length&#12289;Transfer-Encoding</text><polygon fill="#181818" points="595,222.3906,605,226.3906,595,230.3906,599,226.3906" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="226.3906" y2="226.3906"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="146" x="124" y="221.3247">&#22914;&#26524;Host&#19981;&#23384;&#22312;&#65292;&#21017;&#28155;&#21152;</text><polygon fill="#181818" points="595,251.5234,605,255.5234,595,259.5234,599,255.5234" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="255.5234" y2="255.5234"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="300" x="124" y="250.4575">&#22914;&#26524;Connection&#65292;&#21017;&#28155;&#21152;Connection=Keep-Alive</text><polygon fill="#181818" points="595,280.6563,605,284.6563,595,288.6563,599,284.6563" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="284.6563" y2="284.6563"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="369" x="124" y="279.5903">&#22914;&#26524;&#29992;&#25143;&#27809;&#26377;&#25351;&#23450;Accept-Encoding&#21644;Range&#22836;&#65292;&#21017;&#35774;&#32622;&#20026;gzip</text><polygon fill="#181818" points="710,309.7891,720,313.7891,710,317.7891,714,313.7891" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="716" y1="313.7891" y2="313.7891"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="186" x="124" y="308.7231">loadForRequest(): &#21152;&#36733;cookie</text><polygon fill="#181818" points="595,338.9219,605,342.9219,595,346.9219,599,342.9219" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="342.9219" y2="342.9219"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="69" x="124" y="337.856">&#28155;&#21152;Cookie</text><polygon fill="#181818" points="595,368.0547,605,372.0547,595,376.0547,599,372.0547" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="372.0547" y2="372.0547"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="98" x="124" y="366.9888">&#28155;&#21152;User-Agent</text><polygon fill="#181818" points="595,397.1875,605,401.1875,595,405.1875,599,401.1875" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="601" y1="401.1875" y2="401.1875"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="40" x="124" y="396.1216">build()</text><polygon fill="#181818" points="448,426.3203,438,430.3203,448,434.3203,444,430.3203" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="442" x2="606" y1="430.3203" y2="430.3203"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="146" x="454" y="425.2544">new() &#29983;&#25104;&#26032;&#30340;Request</text><polygon fill="#181818" points="845.5,455.4531,855.5,459.4531,845.5,463.4531,849.5,459.4531" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="851.5" y1="459.4531" y2="459.4531"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="275" x="124" y="454.3872">proceed(Request) &#32487;&#32493;&#20854;&#20182;&#25318;&#25130;&#22120;&#30340;&#22788;&#29702;&#27969;&#31243;</text><polygon fill="#181818" points="128,484.5859,118,488.5859,128,492.5859,124,488.5859" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;stroke-dasharray:2.0,2.0;" x1="122" x2="856.5" y1="488.5859" y2="488.5859"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="117" x="134" y="483.52">&#20854;&#20182;&#25318;&#25130;&#22120;&#22788;&#29702;&#23436;&#25104;</text><polygon fill="#181818" points="710,513.7188,720,517.7188,710,521.7188,714,517.7188" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="716" y1="517.7188" y2="517.7188"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="365" x="124" y="512.6528">receiveHeaders(): &#20445;&#23384;cookie&#65292;header&#20013;&#30340;Set-Cookie&#23383;&#27573;</text><line style="stroke:#181818;stroke-width:1.0;" x1="117" x2="159" y1="546.8516" y2="546.8516"/><line style="stroke:#181818;stroke-width:1.0;" x1="159" x2="159" y1="546.8516" y2="559.8516"/><line style="stroke:#181818;stroke-width:1.0;" x1="118" x2="159" y1="559.8516" y2="559.8516"/><polygon fill="#181818" points="128,555.8516,118,559.8516,128,563.8516,124,559.8516" style="stroke:#181818;stroke-width:1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="247" x="124" y="541.7856">&#22914;&#26524;&#21709;&#24212;&#20869;&#23481;&#26159;gzip&#26684;&#24335;&#65292;&#21017;&#36827;&#34892;&#35299;&#21387;&#22788;&#29702;</text><polygon fill="#181818" points="11,584.9844,1,588.9844,11,592.9844,7,588.9844" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="5" x2="116" y1="588.9844" y2="588.9844"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="93" x="17" y="583.9185">&#36820;&#22238; Response</text><!--SRC=[bLJBRjD05DtxAxnCAfaFY00fZK3biIfbrMvS- -9OM3Dcx83AggcQ4aXIAeXAcuOs5IMDaE82eYJDWtmCdh5PzHUOn0w9sW3DpdCVvvnxxv4NiNHJd2Mwgi4TP0DHmBGnYOdwy25SIegyOnwUfC2oOoA2PxCftL21HA9BY1wqtDQcLwonRCFjL6ZcerTQ3skzuW7BRh7jpwFGjR1L2DzZoCEKE3FpJmN3kfX8gsjilxoCrHMtMN2RBPGoZFDEdcPtMUMC5PnVvLM_ccQDDdrLyKyQxCiQFVfstYajeGJcqCYM5bPC-BcQ7Zxl0zBi90yi41bPZu18jv22LHrfKocQmvRD5T7w3YtNGa434LEXS54855l7Q1nY5Brn3y2KueR-5AR23Mx5lXwoyakMVq6TKbpfD_sPbRx9pyj8Wy6o-io-yyFhEdp1sdFTdCoLmFYn3dTbpc9WMRsDISWUYN9UllvkLncKN57gSDYfMnvQ_6fnZL_pYctB_Oz8LBZemb6jEF1y92fEyBFmDnRP60ibahAEOg99i0AWHi9U3jW-zjfrcldkjhTPhigod-XkZOFJetLlQuETfhrQJY1WfmWIBrG59TJ9SqN_FGa11RXDva3cardzaxYzzzoUmKduaPE3ZDkiS_87O4j1Bws_OyxfPFG9Fv30NlHjWRQAT2D3dJEsSzAt3AjqQETrwANUdd-Ozuy_qCrSC8EmU5sw3CUNxlUAT6-Vxz8oCRBWDm00]--></g></svg>

<p>从上述流程可以看出BridgeInterceptor拦截器的处理逻辑比较简单。</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/okhttp/" rel="tag"># okhttp</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/posts/37107c2e.html" rel="prev" title="okhttp详解系列四：缓存拦截器">
                  <i class="fa fa-angle-left"></i> okhttp详解系列四：缓存拦截器
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/posts/8e83ed63.html" rel="next" title="okhttp详解系列二：重试重定向拦截器">
                  okhttp详解系列二：重试重定向拦截器 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 
    <span itemprop="copyrightYear">2024</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">Jason</span>
  </div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener external nofollow noreferrer" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/pisces/" rel="noopener external nofollow noreferrer" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.24/fancybox/fancybox.umd.js" integrity="sha256-oyhjPiYRWGXaAt+ny/mTMWOnN1GBoZDUQnzzgC7FRI4=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>


  <script class="next-config" data-name="mermaid" type="application/json">{"enable":true,"theme":{"light":"default","dark":"dark"},"js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.min.js","integrity":"sha256-K7oJiQlDulzl24ZUFOywuYme1JqBBvQzK6m8qHjt9Gk="}}</script>
  <script type="module" src="/js/zenuml-definition-074a43fa.js"></script>
  <script type="module" src="/js/mermaid-zenuml.esm.min.mjs"></script>
  <script src="/js/third-party/tags/mermaid.js"></script>


  <script src="/js/third-party/fancybox.js"></script>



  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>



</body>
</html>
